package com.caohx.bms.pojo;

import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import org.springframework.http.HttpStatus;
@JsonPropertyOrder({"code", "message", "data"})
public class ResponseMessage<T> {
    private Integer Code ;
    private String message ;
    private  T data;

    public static<T> ResponseMessage<T> success(T data)
    {
        ResponseMessage responseMessage = new ResponseMessage();
        responseMessage.setCode(HttpStatus.OK.value());
        responseMessage.setMessage("success");
        responseMessage.setData(data);
        return responseMessage ;
    }

    public Integer getCode() {
        return Code;
    }

    public void setCode(Integer code) {
        Code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResponseMessage{" +
                "Code=" + Code +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
